﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IView.DiaryAndTracking;

using Engine;

using DataTransferObject.DiaryAndTrackingTask.SupportClassForDiary;

namespace Presenter.DiaryAndTracking
{
    public class PresenterDiaryAnalyzeForm: Presenter
    {
        private IDiaryAnalyzeForm _View;
        private List<JskeEvent> _jskeEvent = new List<JskeEvent>();
        private JskeEngine _jskeEngine = JskeEngine.getInstance(dataServiceMode);
        AnalysisDS analysis = new AnalysisDS();

        public PresenterDiaryAnalyzeForm(IDiaryAnalyzeForm view, int dataAccessMode)
        {
            Presenter.changeDataServiceMode(dataAccessMode);
            this._View = view;
        }
        public PresenterDiaryAnalyzeForm(IDiaryAnalyzeForm view, List<JskeEvent> jskeEvents, int dataAccessMode)
        {
            Presenter.changeDataServiceMode(dataAccessMode);
            this._View = view;
            this._jskeEvent = jskeEvents;
            analysis = _jskeEngine.createAnalysis(jskeEvents);
            _View.createAnalysisGraph(analysis);
        }

        public void createAnalyzeReport(DateTime _from, DateTime _to)
        {
            _jskeEngine.loadDiaryDataToEngine();            
            analysis = _jskeEngine.createAnalysis(_from, _to);
            //Ve do thi tu du lieu Da duoc Analysis
            _View.createAnalysisGraph(analysis);
        }

        public AnalysisDS AnalysisData
        {
            get { return this.analysis; }
            set { this.analysis = value; }
        }
    }
}
